
SET FOREIGN_KEY_CHECKS=0;

-- ----------------------------
-- Table structure for `sys_permission`
-- ----------------------------
DROP TABLE IF EXISTS `sys_permission`;
CREATE TABLE `sys_permission` (
`permission_id`  int(11) NOT NULL AUTO_INCREMENT ,
`permission_type`  int(11) NOT NULL COMMENT '权限类型，0为前端资源权限，1为后端api权限' ,
`permission_name`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '权限名称' ,
`permission_source`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '权限资源' ,
PRIMARY KEY (`permission_id`)
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
AUTO_INCREMENT=4

;

-- ----------------------------
-- Records of sys_permission
-- ----------------------------
BEGIN;
INSERT INTO `sys_permission` VALUES ('1', '1', '查看用户', '/getUser'), ('2', '1', '查看管理员', '/getAdmin'), ('3', '1', '所有人可见', '/hello');
COMMIT;

-- ----------------------------
-- Table structure for `sys_role`
-- ----------------------------
DROP TABLE IF EXISTS `sys_role`;
CREATE TABLE `sys_role` (
`role_id`  int(11) NOT NULL AUTO_INCREMENT ,
`role_name`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '角色名称' ,
`role_description`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '角色描述' ,
PRIMARY KEY (`role_id`)
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
AUTO_INCREMENT=3

;

-- ----------------------------
-- Records of sys_role
-- ----------------------------
BEGIN;
INSERT INTO `sys_role` VALUES ('1', 'admin', '管理员'), ('2', 'user', '普通用户');
COMMIT;

-- ----------------------------
-- Table structure for `sys_role_permission`
-- ----------------------------
DROP TABLE IF EXISTS `sys_role_permission`;
CREATE TABLE `sys_role_permission` (
`role_id`  int(11) NOT NULL ,
`permission_id`  int(11) NOT NULL 
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci

;

-- ----------------------------
-- Records of sys_role_permission
-- ----------------------------
BEGIN;
INSERT INTO `sys_role_permission` VALUES ('1', '1'), ('1', '2'), ('1', '3'), ('2', '1');
COMMIT;

-- ----------------------------
-- Table structure for `sys_user`
-- ----------------------------
DROP TABLE IF EXISTS `sys_user`;
CREATE TABLE `sys_user` (
`user_id`  int(11) NOT NULL AUTO_INCREMENT ,
`name`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户名' ,
`account`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '账号' ,
`password`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户密码' ,
`last_login_time`  datetime NULL DEFAULT NULL COMMENT '上一次登录时间' ,
`enabled`  tinyint(1) NULL DEFAULT 1 COMMENT '账号是否可用。默认为1（可用）' ,
`expired`  tinyint(1) NULL DEFAULT 1 COMMENT '是否过期。默认为1（没有过期）' ,
`locked`  tinyint(1) NULL DEFAULT 1 COMMENT '账号是否锁定。默认为1（没有锁定）' ,
`create_time`  datetime NULL DEFAULT NULL COMMENT '创建时间' ,
`create_by`  int(11) NULL DEFAULT NULL COMMENT '创建人,user_id' ,
`update_time`  datetime NULL DEFAULT NULL COMMENT '修改时间' ,
`update_by`  int(11) NULL DEFAULT NULL COMMENT '修改人' ,
`role_id`  int(11) NULL DEFAULT NULL COMMENT '角色id，一个用户只能拥有一个角色' ,
PRIMARY KEY (`user_id`)
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
AUTO_INCREMENT=3

;

-- ----------------------------
-- Records of sys_user
-- ----------------------------
BEGIN;
INSERT INTO `sys_user` VALUES ('1', '管理员', 'admin', '$2a$10$7jqY0NF0HWUt3Rjl8zmxTOxRe5Eu3x0.8XRsTdOdF3fevz0q7Zlp.', null, '1', '1', '1', null, null, null, null, '1'), ('2', 'livi', 'user', '$2a$10$.DE5S6W7h9v439wD5EGYqeH3RWshFKUzJzX7hKYeGVHGI9eTku8nC', null, '1', '1', '1', null, null, null, null, '2');
COMMIT;

-- ----------------------------
-- Auto increment value for `sys_permission`
-- ----------------------------
ALTER TABLE `sys_permission` AUTO_INCREMENT=4;

-- ----------------------------
-- Auto increment value for `sys_role`
-- ----------------------------
ALTER TABLE `sys_role` AUTO_INCREMENT=3;

-- ----------------------------
-- Auto increment value for `sys_user`
-- ----------------------------
ALTER TABLE `sys_user` AUTO_INCREMENT=3;
